a = [0] * 8
b = [0] * 8
max_time = 0
max_day = 0
for i in range(1, 8):
    a[i], b[i] = map(int, input().split())

for i in range(1, 8):
    if a[i] + b[i] > 8:
        if a[i] + b[i] > max_time:
            max_time = a[i] + b[i]
            max_day = i

print(max_day)